package tesys.objects;
/**
 * @author Group5 Comp3350
 * This class defines a ProjectMember object
 * describe relation between project & member
 * It's a subclass of User
 */
public class ProjectMember
{	
	private String pid;
	private String uid;
	private String name;
	private String position;//one's position in a team, eg: manager
	//constructor
	public ProjectMember(String pid, String uid, String name)
	{
		this.uid = uid;
		this.pid = pid;
		this.name = name;
		this.position = "";
	}
	
	public ProjectMember(String pid, String uid, String name, String pos)
	{
		this.uid = uid;
		this.pid = pid;
		this.name = name;
		this.position = pos;
	}
	//Mutator 
	public void setPosition(String pos)
	{
		position = pos;
	}
	//accessor
	public String getUID(){return uid;}
	public String getPID(){return pid;}
	public String getName(){return name;}
	public String getPosition(){return position;}
	
	//compareTo()
	//to check if 2 objects are same
	public boolean compareTo(Object obj)
	{
		boolean result;
		ProjectMember t;
		
		result = false;
		
		if (obj instanceof ProjectMember)
		{
			t = (ProjectMember) obj;
			if (t.getUID().equalsIgnoreCase(uid) && t.getPID().equalsIgnoreCase(pid))
			{
				result = true;
			}
		}
		return result;
	}

	//toString()
	public String toString () 
	{
		return "Team member: "+getUID()+" "+getName();
	}

}


